Unhandled (in react-apollo) - NOT A NETWORK ERROR #1003
Comments
okay, problem solved... all i have to do is remove the fetchPolicy option, and it works again... this is not very consistent at all, especially since i am successfully using the fetchPolicy option in many other queries even though it's resolved, i'm still hoping for an explanation here as to why fetchPolicy works great in some queries, but breaks the app in other, sometimes more basic, queries |
okay now i'm getting even more odd behavior... the query successfully and consecutively returns/fetches my data 3 times in a row, at an interval of 10 seconds apart (expected, since i'm using polling), but after the 3rd time, it crashes the app and returns the following error: Possible Unhandled Promise Rejection (id: 0): Any ideas? |
okay, issue resolved... what triggers this mysterious error is returning/fetching a node's field value without including the id in the list of values to return in the response(see below)... apparently the id is needed in order to properly cache the response to the store... i don't remember seeing this any where in the docs, pls forgive if i overlooked this constraint INCORRECT: CORRECT: |
Thanks! Was having this issue as well. |
I had the same issue, and resolved with the same solution. Thanks! |
For those having trouble reading the vertically aligned comparison above, here it is formatted: # INCORRECT
query GetUserType($UserId: ID) {
User(id: $UserId) {
type
}
}
# CORRECT
query GetUserType($UserId: ID) {
User(id: $UserId) {
id
type
}
} Also, if your backend doesn't return an # ALIASING!
query GetUserType($UserId: ID) {
User(id: $UserId) {
id: username
type
}
} |
Thanks! Same issue got me :-) |
Thanks @quadsurf! This worked for me! |
Thank you @quadsurf! I spent the past hour searching for the solution to this :) |
This has suddenly turned up in a project of mine with literally thousands of queries distributed over hundreds of components. I have been spending hours searching for a missing id but have not been able to resolve the problem yet :-( |
I was experiencing this issue today, and a colleague of mine helped me fix it.
I looked around for any of my account queries that had a missing ID, but there were none. Turns out I had to also add an ID to my company item too, in order for Apollo to correctly cache it.
Doing that solved my problem :D |
This issue has burned me several times. The worst part is that I don't even want a cache, I've done everything in my power to disable the cache. |
i have dozens of queries and mutations in my app, and they all work great, but the second i add the following query (a super basic query), i get the following error:
Unhandled (in react-apollo)
THIS IS NOT A NETWORK ERROR since all other queries still work!
This error is not too helpful and lacks any meaningful information to help me debug.
Please note that permissions aren't the issue, and the query below when tested in GraphiQL playground, works perfectly.
Also, to avoid github formatting, i changed the gql back ticks below from `` to ''
import { compose,graphql } from 'react-apollo'
const GetUserType = gql'
query GetUserType(
$UserId: ID
){
User(
id: $UserId
){
type
}
}'
export default compose(
graphql(GetUserType,{
name: 'getUserType',
options: props => ({
variables: {
UserId: props.user.id
},
fetchPolicy: 'network-only'
})
})
)(Colors)
LIB VERSIONS:
react-native@latest
react-apollo@1.4.8
The text was updated successfully, but these errors were encountered: